package com.lsj;

/**
 * @author Lsj
 * @version 1.0
 * @date 2021/6/22 23:07
 */
public class ArrayAlg {
    public static <T extends Comparable> T min(T[] a){
        if (a==null||a.length==0){
            return null;
        }
        T smallest = a[0];
        for (int i = 0; i < a.length; i++) {
            if (smallest.compareTo(a[i])>0)smallest=a[i];
        }
        return smallest;
    }
}
